package com.dq;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName WebServerAutoConfiguration
 * @Description WebServer自动装配配置类  利用Condition自动注入Bean然后start启动 todo:利用ConditionOnClass使用虚拟Condition加载
 * @Author DuX1aoQiang
 * @Date 2023/5/19 21:37
 * @Version 1.0
 */
@Configuration
public class WebServerAutoConfiguration {

    @Bean
//    @Conditional(JettyCondition.class)
    @ConditionOnClass("org.eclipse.jetty.util.Jetty")
    public JettyWebServer jettyWebServer() {
        return new JettyWebServer();
    }

    @Bean
//    @Conditional(TomcatCondition.class)
    @ConditionOnClass("org.apache.catalina.startup.Tomcat")
    public TomcatWebServer tomcatWebServer() {
        return new TomcatWebServer();
    }
}
